import request from '@/utils/request'

/**
 * 获取部门列表
 * @returns Promise<[Object]>
 */
export const deptGetDepartmentsApi = () => request.get('/company/department')

export const getDepartment = () => request.get('/company/department')

/**
 * 获取部门负责人
 * @returns Promise<[Object]>
 */
export const deptGetManagersApi = () => request.get('/sys/user/simple')

/**
 * 新增部门
 * @param {*} data
 * @returns Promise<Object>
 */
export const deptAddDepartmentApi = (data) => request.post('/company/department', data)

/**
 * 获取部门详情
 * @param {*} id 部门 id
 * @returns Promise<Object>
 */
export const deptGetDepartmentDetailApi = (id) => request.get(`/company/department/${id}`)

/**
 * 修改部门
 * @param {*} data
 * @returns Promise<string | null>
 */
export const deptUpdateDepartmentApi = (data) => request.put(`/company/department/${data.id}`, data)

/**
 * 删除部门
 * @param {*} id
 * @returns Promise<null>
 */
export const deptDeleteDepartmentApi = (id) => request.delete(`/company/department/${id}`)
